package cc.admin.modules.quartz.service;

import cc.admin.modules.quartz.entity.QuartzJob;
import com.baomidou.mybatisplus.extension.service.IService;
import org.quartz.SchedulerException;

import java.util.List;

/**
 * @Description: 定时任务在线管理
 * @Author: jeecg-boot
 * @Date: 2019-04-28
 * @Version: V1.1
 */
public interface IQuartzJobService extends IService<QuartzJob> {

	List<QuartzJob> findByJobClassName(String jobClassName);

	boolean saveAndScheduleJob(QuartzJob quartzJob);

	boolean editAndScheduleJob(QuartzJob quartzJob) throws SchedulerException;

	boolean deleteAndStopJob(QuartzJob quartzJob);

	boolean resumeJob(QuartzJob quartzJob);

	/**
	 * 添加定时任务
	 *
	 * @param jobId
	 * @param jobClassName
	 * @param cronExpression
	 * @param parameter
	 */
	public void schedulerAdd(String jobId, String jobClassName, String cronExpression, String parameter);

	/**
	 * 删除定时任务
	 *
	 * @param jobId
	 */
	public void schedulerDelete(String jobId);

    void execute(String id);
}
